<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        ul{
            list-style: none;
        }
        #box{
            width: 400px;
            margin: 0 auto;
        }
        #tab{
            display: flex;
            width: 100%;
            height: 30px;
            list-style: none;
            background: #000;
            color: #fff;
            
        }
        #tab li{
            border: 1px solid #000;
        }
        .check{
            background: #fff;
            color: #000;
        }
        #boxs{
            border: 1px solid #000;
        }
        #boxs ul{
            display: none;
        }
    </style>
</head>

<body>
    <div id="box">
        <ul id="tab">
            <li class="check">第一节课</li>
            <li>第二节课</li>
            <li>第三节课</li>
        </ul>
        <div id="boxs">
            <ul style="display:block ;">
                <li>第一节课学</li>
                <li>html</li>
                <li>css</li>
            </ul>
            <ul>
                <li>第二节课学</li>
                <li>js</li>
                <li>jquery</li>
            </ul>
            <ul>
                <li>第三节课学</li>
                <li>vue2</li>
                <li>vue3</li>
            </ul>
        </div>
    </div>
</body>
<script>
    window.onload = function (){
        var ul = document.getElementById('boxs').getElementsByTagName('ul')
        var li = document.getElementById('tab').getElementsByTagName('li')
        for(var i = 0 ; i < li.length ; i++){
            li[i].index = i
            li[i].onmouseover = function(){
                for(var y = 0 ; y < li.length ; y++) {
                    li[y].className = ""
                }
                this.className = "check"
                for(var n = 0 ; n < ul.length;n++){
                    ul[n].style.display = "none"
                }
                ul[this.index].style.display = "block"
            }
        }
    }
</script>
</html>